# -*- coding:utf-8 -*-

__author__ = 'shudongma.msd(风骐)'


import datetime

# strdate = datetime.datetime.strptime('2014-11-18', "%Y-%m-%d").date()
# endate = datetime.datetime.strptime('2014-12-18', "%Y-%m-%d").date()
# while strdate <= endate:
#     s = """
#     select user_id,item_id,item_category,sum(visit_count) as visit_10_cnt,sum(store_count) as store_10_cnt,
#     sum(cart_count) as cart_10_cnt,sum(buy_count) as sum_10_cnt,'"""+str(strdate)+"""' as day
#     from tianchi_train_ug2 where  to_date(day, 'yyyy-mm-dd') >= dateadd('"""+str(strdate)+""" 00:00:00', -10, 'dd') and to_date(day, 'yyyy-mm-dd') <= to_date('"""+str(strdate)+"""', 'yyyy-mm-dd')
#     group by user_id,item_id,item_category
#     union all
#     """
#     print s
#     strdate = strdate + datetime.timedelta(days=1)






# def log(func):
#     def wrapper(*args, **kw):
#         print 'call %s():' % func.__name__
#         return func(*args, **kw)
#     return wrapper
#
# @log
# def now():
#     print '2013-12-25'
#
# now()


# def log(text):
#     def decorator(func):
#         def wrapper(*args, **kw):
#             print '%s %s():' % (text, func.__name__)
#             return func(*args, **kw)
#         return wrapper
#     return decorator
#
# @log('execute')
# def now():
#     print '2013-12-25'
#
# now()


import functools

def log(func):
    @functools.wraps(func)
    def wrapper(*args, **kw):
        print 'call %s():' % func.__name__
        return func(*args, **kw)
    return wrapper